<script  lang="ts" setup="">

import {ref} from "vue";
import {useRouter} from "vue-router";

const router = useRouter()
const user = ref({
  id: '',
  username: '',
  userAccount: '',
  avatarUrl: '',
  gender: '',
  phone: '',
  email: '',
  planeCode: '',
  createTime: ''
})
const toEdit = (editKey: string, editName: any, currentValue: string) =>{
  router.push({
    path: '/user/edit',
    query: {
      editKey,
      editName,
      currentValue
    }
  })
}
</script>

<template>
  <van-cell-group>
    <van-cell title="昵称" is-link to="/user/edit" :value="user.username" />
    <van-cell title="账号"  :value="user.userAccount" label="描述信息" />
    <van-cell title="头像" is-link to="/user/edit"  :value="user.avatarUrl">
      <img :src="user.avatarUrl" alt="头像">
    </van-cell>
    <van-cell title="性别" is-link to="/user/edit" @click="toEdit('gender', '性别', user.gender)" :value="user.gender" label="描述信息" />
    <van-cell title="电话" is-link to="/user/edit" @click="toEdit('phone', '电话', user.phone)" :value="user.phone" />
    <van-cell title="邮箱" is-link to="/user/edit" @click="toEdit('email', '邮箱', user.email)" :value="user.email" label="描述信息" />
    <van-cell title="星球编号" :value="user.planeCode" />
    <van-cell title="注册时间" :value="user.createTime" label="描述信息" />
  </van-cell-group>
</template>

<style scoped lang="less">

</style>
